﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;

using Tea;
using Tea.Utils;


namespace _12_AI
{
        public class Sample
        {
        AlibabaCloud.SDK.Dingtalkassistant_1_0
            /// <term><b>Description:</b></term>
            /// <description>
            /// <para>使用 Token 初始化账号Client</para>
            /// </description>
            /// 
            /// <returns>
            /// Client
            /// </returns>
            /// 
            /// <term><b>Exception:</b></term>
            /// Exception
            public static AlibabaCloud.SDK.Dingtalkassistant_1_0.Client CreateClient()
            {
                AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config();
                config.Protocol = "https";
                config.RegionId = "central";
                return new AlibabaCloud.SDK.Dingtalkassistant_1_0.Client(config);
            }

            public static void Main(string[] args)
            {
                AlibabaCloud.SDK.Dingtalkassistant_1_0.Client client = CreateClient();
                AlibabaCloud.SDK.Dingtalkassistant_1_0.Models.CreateAssistantThreadHeaders createAssistantThreadHeaders = new AlibabaCloud.SDK.Dingtalkassistant_1_0.Models.CreateAssistantThreadHeaders();
                createAssistantThreadHeaders.XAcsDingtalkAccessToken = "<your access token>";
                Dictionary<string, string> metadata = new Dictionary<string, string>
            {
                {"key", "String"},
            };
                AlibabaCloud.SDK.Dingtalkassistant_1_0.Models.CreateAssistantThreadRequest createAssistantThreadRequest = new AlibabaCloud.SDK.Dingtalkassistant_1_0.Models.CreateAssistantThreadRequest
                {
                    Metadata = metadata,
                };
                try
                {
                    client.CreateAssistantThreadWithOptions(createAssistantThreadRequest, createAssistantThreadHeaders, new AlibabaCloud.TeaUtil.Models.RuntimeOptions());
                }
                catch (TeaException err)
                {
                    if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message))
                    {
                        // err 中含有 code 和 message 属性，可帮助开发定位问题
                    }
                }
                catch (Exception _err)
                {
                    TeaException err = new TeaException(new Dictionary<string, object>
                {
                    { "message", _err.Message }
                });
                    if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message))
                    {
                        // err 中含有 code 和 message 属性，可帮助开发定位问题
                    }
                }
            }
        }
    }

